//清空tableList
document.querySelector("#btn_clear").onclick = function () {
    layui.use("layer", function(){
        var layer = layui.layer;
        layer.confirm("这将清除添加的所有数据", { title: "确认清空" }, function (index) {
            //do something
            removeItem("tableList");
            clearTable();
            layer.close(index);
            layui.use("layer", function(){
                var layer = layui.layer;
                layer.msg("清除完成", {time: 1000});
            });
        });
    });
}

function clearTable() {
    let elem = document.querySelectorAll(".tableList");
    if (elem != null) {
        for (let i = 0; i < elem.length; i++) {
            elem[i].parentNode.removeChild(elem[i]);
        }
    }
}